package cn.com.jrr.core.service.hat;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.com.jrr.core.dao.impl.BaseDaoImpl;
import cn.com.jrr.core.model.hat.Area;
import cn.com.jrr.core.model.hat.City;
import cn.com.jrr.core.model.hat.Province;
import cn.com.jrr.core.model.hat.School;

@Service
public class HatService {
	@SuppressWarnings("rawtypes")
	@Resource
	private BaseDaoImpl baseDaoImpl;

	/**
	 * 查询省份
	 * */
	@SuppressWarnings("unchecked")
	public List<Province> provinceList(){
		List<Province> provinces=baseDaoImpl.findBySql("select * from hat_province",Province.class);
		return provinces;
	}
	/**
	 * 查询城市
	 * */
	@SuppressWarnings("unchecked")
	public List<City> cityList(String father){
		List<City> citys=baseDaoImpl.findBySql("select * from hat_city where father=?",City.class,new Object[]{father});
		return citys;
	}
	/**
	 * 查询区
	 * */
	@SuppressWarnings("unchecked")
	public List<Area> areaList(String father){
		List<Area> areas=baseDaoImpl.findBySql("select * from hat_area where father=?",Area.class,new Object[]{father});
		return areas;
	}
	/**
	 * 查询学校
	 * */
	@SuppressWarnings("unchecked")
	public List<School> schoolList(String place){
		List<School> places=baseDaoImpl.findBySql("select * FROM school WHERE place=?",School.class,new Object[]{place});
		return places;
	}

}
